import java.util.Scanner;

public class Day_29_2_有假币 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        while(scan.hasNext()) {
            int n = scan.nextInt();
            while(true) {
                if(n == 0) {
                    break;
                }
                int count = 0;
                while(n != 1) {
                    // 分成三份，取出最轻的进行下一次称重
                    if(n % 3 == 0) {
                        n = n / 3;
                        count ++;
                    } else {
                        n = n / 3 + 1;
                        count ++;
                    }
                }
                System.out.println(count);
                n = scan.nextInt();
            }
        }
    }
}
